﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace KnBinarySerializer.Brick
{

    internal class ByteFormatter : IFormatter
    {
        public Type GetHandleType()
        {
            return typeof(byte);
        }
        public bool IsFixLen()
        {
            return true;
        }
        public byte GetKey()
        {
            return 12;
        }

        public object ReadBytes(BinarySerializeManager content, int maxLen, Type type)
        {
            return content.ReadByte();
        }

        public int WriteBytes(BinarySerializeManager serial, object obj)
        {
            serial.Write((byte)obj);
            return 1;
        }
    }
}
